#ifndef SETUPWINDOW_H
#define SETUPWINDOW_H

#include <QMainWindow>
#include <QtGui>

#include "gameworld.h"
#include "worldcommand.h"
#include "dynalabel.h"
#include "player.h"

namespace Ui {
class SetupWindow;
}

class SetupWindow : public QMainWindow
{
    Q_OBJECT
    
public:
    explicit SetupWindow(QWidget *parent = 0);
    ~SetupWindow();
    

public slots:
    //for getting information about setup
    void on_doneSelecting(const QString &newDifficulty, const QString &newMode, const QString &newName);

private:
    Ui::SetupWindow *ui;

    int centerX, centerY;
    vector<DynaLabel*> watertilelabels;
    vector<DynaLabel*> shiplabels;
    vector<DynaLabel*> opponentwatertilelabels;

    //for containing information retrieved from main menu
    QString difficulty, mode, username;

    Player *aiplayer;


    //methods for window
    void buildTileGrid(QString whichPlayer);
    void drawTileGrid(QString whichPlayer);

    //methods for water tile labels
    void updateTiles();
    void addWaterTileLabel(DynaLabel* newLabel);
    vector<DynaLabel*>& getWaterTileLabels() { return watertilelabels; }
    void addOpponentWaterTileLabel(DynaLabel *newLabel);
    vector<DynaLabel*>& getOpponentWaterTileLabels() { return opponentwatertilelabels; }
    void syncTilesAndShips(QString whichPlayer);

    //methods for ship labels
    void drawShips();
    void addShipLabel(DynaLabel* newLabel);
    void updateShips();
    vector<DynaLabel*> getShipLabels() { return shiplabels; }

    void rearrangeShips();
    void redrawShots();




private slots:
    //slots for tiles
    void on_tileClicked();



    void on_btnMoveRight_clicked();

    void on_btnRearrangeShips_clicked();

    void on_btnDonePlacing_clicked();

    void on_btnFire_clicked();

    void on_btnFire_released();

    void on_playerFired();

    void on_btnUpdateShips_clicked();

    void on_btnCheat_clicked();

    void on_shipSunk(QString whichPlayer, QString whichVictim, QString whichShip);

    void on_playerWon(QString whichPlayer);

    void on_btnResign_clicked();

    void on_btnSaveGame_clicked();

    void on_btnLoad_clicked();

signals:
    void myShipsPlaced();

    void playerFired();

    void shipSunk(QString whichPlayer, QString whichVictim, QString whichShip);

    void playerWon(QString whichPlayer);

    void newGame();

};

#endif // SETUPWINDOW_H
